function [Mdl, score] = trainNB(pred, resp)

% Fit a naive Bayes classifier on the [pred (X) resp (y)] data.
Mdl = fitcnb(pred, resp);

% The second column of score contains the posterior probabilities.
[~,score] = resubPredict(Mdl);  

end